Func _log($event, $fileName = "auto.log", $filePath = "C:\DSAUTO")	;//write to folder log "dsAuto.log"

	$DateNow = @YEAR & "-" & @MON & "-" & @MDAY
	$TimeNow = @HOUR & ":" & @MIN & ":" & @SEC

	If FileExists($filePath & "\log") = 0 Then    
		DirCreate($filePath & "\log")            
	EndIf

	$file = FileOpen($filePath & "\log\" & $fileName, 1) ;Write mode (append to end of file)
	
	FileWriteLine($file, $DateNow & " " & $TimeNow & " " & $event & @CRLF)
	FileClose($file)	
EndFunc
